/**
 * @Author liangzai
 * @Description:
 */
public class Test {
    public int removeElement(int[] nums, int val) {
        int left=0;
        int right = nums.length-1;
        int count=0;
        while(left <= right){
            if(nums[left]==val){
                int tmp = nums[left];
                nums[left] = nums[right];
                nums[right] = tmp;
                right--;
            }else{
                count++;
                left++;
            }
        }
        return count;
    }
}
